<?php

namespace frontend\models;

use Yii;

/**
 * This is the model class for table "pn_hang_hoa_detail".
 *
 * @property integer $pid
 * @property string $ma_hang
 * @property string $ten_hang
 * @property string $dvt
 * @property string $sl_ycau
 * @property string $sl_thuc
 * @property string $don_gia
 * @property string $thue_suat
 * @property integer $tien_thue
 * @property string $thanh_tien
 * @property string $tk_no
 * @property string $tk_co
 * @property integer $order
 *
 * @property PnKho $pnkho
 */
class PnKhoDetail extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'pn_kho_detail';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['pid', 'ma_hang', 'ten_hang', 'dvt', 'sl_thuc', 'don_gia', 'thanh_tien', 'tk_no', 'tk_co'], 'required'],
            [['pid', 'sl_ycau', 'sl_thuc', 'don_gia', 'thanh_tien'], 'integer'],
            [['ma_hang', 'ten_hang'], 'string', 'max' => 20],
            [['dvt'], 'string', 'max' => 10],
            [['tk_no', 'tk_co'], 'string', 'max' => 5]
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'pid' => 'Pnhh ID',
            'ma_hang' => 'Ma Hang',
            'ten_hang' => 'Ten Hang',
            'dvt' => 'Dvt',
            'sl_ycau' => 'Sl Ycau',
            'sl_thuc' => 'Sl Thuc',
            'don_gia' => 'Don Gia',
            'thanh_tien' => 'Thanh Tien',
            'tk_no' => 'Tk No',
            'tk_co' => 'Tk Co',
        ];
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getPnk()
    {
        return $this->hasOne(PnKho::className(), ['id' => 'pid']);
    }
}
